﻿<div ms-controller="tempview">

    <div class="sui-form form-inline" style="padding-top:5px;">
     
 
       
        <input type="text" ms-duplex="searchkey" placeholder="关键字搜索" class="input-large input-xfat" />
        <a class="sui-btn btn-large btn-primary" style="margin-left:10px;" ms-click="GetLIST()">查询</a>
        <!--<a style="margin-left:10px;" class="sui-btn btn-large btn-success" ms-click="ADD('')" >添加</a>-->
    </div>

    <div>
        <table class="sui-table table-primary table-zebra">
            <thead>
                <tr>
                    <th>单位名</th>
                    <th>车牌号</th>
                    <th>颜色</th>
                    <th>生产厂家</th>
                    <th>挂牌时间</th>
                    <th>车型</th>
                    <th>吨位</th>
                    <th>车厢形式</th>
                    <th>年检月份</th>
                    <th>营运检月份</th>
                    <th>车厢尺寸</th>
                    <th>挂靠</th>
                    <th>车主电话</th>
                    <th>保险信息</th>
                    <th>投保公司</th>
                    <th>保额</th>
                    <th>期限</th>
                    <th>驾驶员</th>
                    <th>身份证</th>
                    <th>电话</th>
                    <th style="width:70px">创建时间</th>
                    <!--<th style="width:40px">状态</th>
                    <th style="width:150px">操作</th>-->
                </tr>
            </thead>
            <tbody>
                <tr ms-repeat-el="ListData">
                    <td>{{el.COMNAME}}</td>
                    <td>{{el.CARID}}</td>
                    <td>{{el.CARCOLOR}}</td>
                    <td>{{el.SUPPLYER}}</td>
                    <td>{{el.ONTIME}}</td>
                    <td>{{el.CARTYPE}}</td>
                    <td>{{el.WEIGHT}}</td>
                    <td>{{el.CARMODEL}}</td>
                    <td>{{el.CHECKYEAR}}</td>
                    <td>{{el.RUNCHECK}}</td>
                    <td>{{el.CARSIZE}}</td>
                    <td>{{el.LINKCOMANY}}</td>
                    <td>{{el.OWNERPHONE}}</td>
                    <td>{{el.INSURANCE}}</td>
                    <td>{{el.INSURCOMPANY}}</td>
                    <td>{{el.INSURAMOUNT}}</td>
                    <td>{{el.INSURPICTURE}}</td>
                    <td>{{el.DRIVERNAME}}</td>
                    <td>{{el.DRIVERID}}</td>
                    <td>{{el.DRIVERPHONE}}</td>
                </tr>
            </tbody>
        </table>
    </div>

   

</div>
<script type="text/javascript">
    var tempmodel = avalon.define({
        $id: "tempview",
        searchkey: "",
        Type2: "",
        TypeList1: [],
        TypeList2: [],
        IsShelf: "",
        ToTop:"",
        Init: function () {
            $.getJSON("/adapi/base/cate/list/1/0", function (r) {
                tempmodel.TypeList1 = r.result;
            })
            tempmodel.GetLIST();
        },
        GetLIST: function () {
            model.page.pageindex = 1;
            model.ListData.clear();
            $.getJSON("/adapi/base/car/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize, "searchkey": model.searchkey}, function (r) {
                if (r.error == "") {
                    model.ListData = r.result;
                    model.total = r.total;

                    $("#pageDiv").pagination({  //分页容器
                        styleClass: ['sui-pagination'],  //分页样式
                        //showCtrl: false,
                        displayPage: 6,
                        itemsCount: r.total,
                        pageSize: model.page.pagesize,
                        onSelect: function (num) {
                            model.page.pageindex = num;
                            $.getJSON("/adapi/base/car/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize, "searchkey": model.searchkey}, function (r) {
                                model.ListData.clear();
                                model.ListData = r.result;
                            })
                        }
                    })

                    $('#pageDiv').pagination('updateItemsCount', r.total, 1);
                }
            })
        }


    })

    tempmodel.$watch("Type1", function () {
        tempmodel.TypeList2.clear();
        tempmodel.Type2 = "";
        if (tempmodel.Type1) {
            $.getJSON("/adapi/base/cate/list/1/" + tempmodel.Type1, function (r) {
                tempmodel.TypeList2 = r.result;
            })
        }

    })


</script>

